//
//  CharityWalkathonController.m
//  Bracelet
//
//  Created by steve on 15-3-18.
//  Copyright (c) 2015年 jing zhao. All rights reserved.
//

#import "CharityWalkathonController.h"
#import "ProjectDetailsView.h"
#import "NextPrejectDetails.h"
@interface CharityWalkathonController ()

@end

@implementation CharityWalkathonController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

  
  ProjectDetailsView *projectView = [[[NSBundle mainBundle]loadNibNamed:@"ProjectDetailsView" owner:self options:nil] lastObject];
  [(ProjectDetailsView *)projectView loadLearnMoreInfor];
  NextPrejectDetails *nextView = [[[NSBundle mainBundle]loadNibNamed:@"NextPrejectDetails" owner:self options:nil] lastObject];
  [self.pageScrollView addSubview:projectView];
  [self.pageScrollView addSubview:nextView];
  
  [self.headPageSwitchView initButtonArrayWithNum:2];
  
  self.pageScrollView.pagerDelegate = self;
  self.headPageSwitchView.m_delegate = self;

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)viewDidLayoutSubviews
{
  CGFloat width = [[UIScreen mainScreen] bounds].size.width;
  CGFloat height = [[UIScreen mainScreen] bounds].size.height;
  CGFloat tempHeight = height-90;
  CGFloat tempWidth = width-20;
  
  //self.ui_scrollView.frame.size.width
  [self.pageScrollView setContentSize:CGSizeMake(tempWidth*2, 0)];
  for (int i=0; i<2; i++) {
    UIView *view = [self.pageScrollView.subviews objectAtIndex:i];
    view.frame = CGRectMake(tempWidth*i, 0, tempWidth, tempHeight);
  }
    [super viewDidLayoutSubviews];
}
-(BOOL)prefersStatusBarHidden{
    //return YES;
    return NO;
}
-(void)awakeFromNib{
  
}

#pragma mark - deleage
-(void)firePagerChanged:(FireUIPagedScrollView*)pager pagesCount:(NSInteger)pagesCount currentPageIndex:(NSInteger)currentPageIndex
{
  [self.headPageSwitchView setHeaderPageChangGoToButtonIndex:currentPageIndex];
  
}

//headerview Delegagte
-(void)delegateOnHeadPageSwitchButtonTap:(NSInteger)_integerSwitchButton
{
  [self.pageScrollView gotoPage:_integerSwitchButton animated:YES];
}

- (IBAction)back:(id)sender {
  [self dismissViewControllerAnimated:YES completion:^{
    
  }];
}
@end
